package com.booksystem.campuslibrarymanagementsystem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.booksystem.campuslibrarymanagementsystem.commen.request.userquest.BookBorrowrequst.Approval;
import com.booksystem.campuslibrarymanagementsystem.commen.request.userquest.ReservaTable;
import com.booksystem.campuslibrarymanagementsystem.commen.result.userresuilt.ReservationTablelist;
import com.booksystem.campuslibrarymanagementsystem.entity.BooksTable;
import com.booksystem.campuslibrarymanagementsystem.entity.RenewalapprovalTable;
import com.booksystem.campuslibrarymanagementsystem.entity.ReservationTable;
import com.booksystem.campuslibrarymanagementsystem.mapper.ReservationTableMapper;
import com.booksystem.campuslibrarymanagementsystem.service.ReservationTableService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

@Service
public class ReservationTableServiceImpl extends ServiceImpl<ReservationTableMapper, ReservationTable> implements ReservationTableService {
    @Autowired
    ReservationTableMapper reservationTableMapper;
    @Override
    public  int add(ReservationTable bb){
        return reservationTableMapper.add(bb);
    }

    @Override
    public   List<ReservationTable> existsByAccountAndBookidi(String account, int bookid){
        return  reservationTableMapper.existsByAccountAndBookidi(account,bookid);
    }
    @Override
    public List<ReservationTablelist> appointlist(@Param("account") String account){
        return reservationTableMapper.appointlist(account);
    }

    @Override
    public List<ReservationTablelist> appointliststatus(String account, String status){
        return reservationTableMapper.appointliststatus(account,status);
    }
    @Override
    public int updatestatus(String account, int reservationid, String status){
        return reservationTableMapper.updatestatus(account,reservationid,status);
    }
    @Override
    public  int deleteByAccountAndBookid(@Param("account") String account, @Param("reservationid") int reservationid){
        return reservationTableMapper.deleteByAccountAndBookid(account,reservationid);
    }
    @Override
    public BooksTable aaa(int bookid){
        return reservationTableMapper.aaa(bookid);
    }
    @Override
    public ReservaTable queryid(int bookid){
        return  reservationTableMapper.queryid(bookid);
    }

    @Override
    public List<ReservationTable> queryByAccount(String account) {
        return reservationTableMapper.queryByAccount(account);
    }

    @Override
    public void unapproval(String account, LocalDate approvalTime, String bookid, String Approvalstate) {
        reservationTableMapper.unapproval(account,approvalTime,bookid,Approvalstate);
    }

    @Override
    public void onapproval(String account, LocalDate approvalTime, String bookid, String Approvalstate) {
        reservationTableMapper.onapproval(account,approvalTime,bookid,Approvalstate);
    }

    @Override
    public List<ReservationTable> querydislist(String status) {
        return reservationTableMapper.querydislist(status);
    }
}
